﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Vds2465Telegrams
{
	public enum eDisruptionCode
	{
		/// <summary>
		/// 0x01
		/// </summary>
		LowVoltage = 0x01,			// the byte value is important and used in casting

		/// <summary>
		/// 0x02
		/// </summary>
		AccumulatorError = 0x02,	// the byte value is important and used in casting

		/// <summary>
		/// 0x03
		/// </summary>
		NetworkError = 0x03,		// the byte value is important and used in casting

		/// <summary>
		/// 0x17
		/// </summary>
		PrimaryTransmissionError = 0x017,		// the byte value is important and used in casting

		/// <summary>
		/// 0x18
		/// </summary>
		SecondaryTransmissionError = 0x18		// the byte value is important and used in casting
	}

    public class UserData_20_State : UserData_Report
    {
        #region constructor

		/// <summary>
		/// Address Extension is Input or Output variant
		/// </summary>
        public UserData_20_State(byte device, byte address, byte addressAddOn, eAddressExtension_1_InputOutput addressExtension, ReportType_Base reportTypeBase)
			: base(UserData.UserData20State, device, address, addressAddOn, (eAddressExtension_1) addressExtension, reportTypeBase)
		{
		}

		/// <summary>
		/// Address Extension is Disruption
		/// </summary>
		public UserData_20_State(byte device, eDisruptionCode disruptionCode, byte addressAddOn, ReportType_Base reportTypeBase)
			: base(UserData.UserData20State, device, (byte)disruptionCode, addressAddOn, eAddressExtension_1.Disruption, reportTypeBase)
		{
		}

		#endregion constructor

		#region ToString, Equals, GetHashCode

		public override int GetHashCode()
		{
			int hashCode = base.GetHashCode();
			return hashCode;
		}

		public override string ToString()
		{
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.Append("(");
			stringBuilder.Append(ToStringProperties());
			stringBuilder.Append(")");

			return stringBuilder.ToString();
		}

		internal override string ToStringProperties()
		{
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.Append(base.ToStringProperties());

			return stringBuilder.ToString();
		}

		public override bool Equals(object obj)
		{
			Type objType = obj.GetType();
			if (this.GetType() == objType)
			{
				UserData_20_State userData2Compare = obj as UserData_20_State;
				return EqualsProperties(userData2Compare);
			}

			return false;
		}

		internal bool EqualsProperties(UserData_20_State userData2Compare)
		{
			return (base.EqualsProperties(userData2Compare));
		}

		#endregion ToString, Equals, GetHashCode
    }
}
